<?php
/* @var $model AppModel */

class Reporting extends AppModel
{

	public $name = 'Reporting';

	public $displayField = 'date';

	public $validate = array(
	);

	public $belongsTo = array(
        'Client' => array('className' => 'Client'),
        'Report' => array('className' => 'Report'),
        'Testing' => array('className' => 'Testing'),
        'Blob' => array('className' => 'Blob',
            'dependent' => true,
        ),
	);

	public $hasOne = array(
        'Pass' => array('className' => 'Pass'),
	);

	function allowDelete($fields = null)
	{
        return false;
	}

	function allowUpdate($fields = null)
	{
        return true;
	}

	function generateList($conds = array())
	{
	    if (Auth::o()->is('client_admin')) {
            $auth_data = Auth::o()->data();
            $conds[]["`{$this->name}`.`client_id`"] = $auth_data['client_id'];
	    }
	    $this->rel();
        return parent::generateList($conds, $this->primaryKey, null, "{n}.{$this->name}.{$this->primaryKey}", "{n}.{$this->name}.{$this->displayField}");
	}
}

?>